home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir36 / zipall12.zip / RESTZIP.BAT < prev    next >
DOS Batch File  |  1993-09-15  |  7KB  |  174 lines

  1. @echo off
  2. REM
  3. REM RESTZIP.BAT
  4. REM
  5. REM This batch file restores an UNZIPALLed ALLFILES.ZIP file as the
  6. REM only file in the current subdirectory.  
  7. REM
  8. REM If the file ZIPALL1.USD is present in the current subdirectory 
  9. REM (indicating that ZIPALL1.BAT was used to create the ALLFILES.ZIP --
  10. REM and thus ALLFILES.ZIP contains no files from children subdirectories),
  11. REM it will display all files within ONLY the current subdirectory that 
  12. REM have the Archive attribute, as an indication of whether any files were
  13. REM changed or added since UNZIPALL.BAT was executed. 
  14. REM 
  15. REM If the file ZIPALL1.USD is NOT present in the current subdirectory,
  16. REM (indicating that ZIPALL.BAT was used to create the ALLFILES.ZIP --
  17. REM and thus ALLFILES.ZIP DOES contain files from children subdirectories),
  18. REM it will display all files within the current subdirectory AND any 
  19. REM children subdirectories that have the Archive attribute, as an indication
  20. REM of whether any files were changed or added since UNZIPALL.BAT executed.
  21. REM
  22. REM
  23. REM After displaying files with the Archive attribute, the user must select:
  24. REM
  25. REM N -- No change   ALLFILES.ZIP will not be updated and the other files
  26. REM                  will be deleted, child subdirectories removed, if any.
  27. REM
  28. REM U -- Update      ALLFILES.ZIP file will be updated with changed or added
  29. REM                  files, in a move method that removes files and dirs.  
  30. REM
  31. REM X -- Exit        To exit RESTZIP.BAT with no action taken.
  32. REM
  33. REM
  34. REM This BAT file:
  35. REM   requires the use of the MS-DOS 5.0 (+) ATTRIB and DIR commands.
  36. REM   requires the use of Patri-Soft's PDEL.EXE (Shareware)
  37. REM   requires my WHICHWAY.EXE (Freeware)
  38. REM   requires my FEED.EXE (Freeware)
  39. REM
  40. cls
  41. if exist ALLFILES.ZIP goto continue
  42. echo.
  43. echo ALLFILES.ZIP does not exist in this subdirectory -- cannot be restored as
  44. echo the only file.  Use ZIPALL or ZIPALL1 to create a new ALLFILES.ZIP.
  45. goto exit
  46. :continue
  47. if not exist ZIPALL1.USD goto nowarn
  48. dir /aa /b | more
  49. echo.
  50. echo If any file names are listed above, they are files that were changed or added
  51. echo since you unzipped ALLFILES.ZIP with UNZIPALL.BAT.  You may want to Update
  52. echo ALLFILES.ZIP with the new versions of the changed files (and add any newly
  53. echo created files to it.)  Otherwise, you'll want to simply delete every file
  54. echo except ALLFILES.ZIP to leave it as it was before you ran UNZIPALL.BAT.
  55. echo Even if no files have changed, you can select Update to force the Archive
  56. echo attribute to be turned on for ALLFILES.ZIP, for backup purposes.
  57. echo Decide now, while viewing the list of files, above, before continuing.
  58. pause
  59. cls
  60. whichway X,U,N
  61. if errorlevel 255 goto abort
  62. if errorlevel 3 goto nochange
  63. if errorlevel 2 goto update
  64. if errorlevel 1 goto abort
  65. :nochange
  66. attrib -h -s -r *.*
  67. pdel allfiles.zip /o /wh /ba /eq /nt 
  68. if not exist allfiles.zip echo ALLFILES.ZIP blown somehow!! -- Unerase it now!
  69. REM *****************  USER MUST EDIT THE FOLLOWING LINE ********************* 
  70. REM *****************  TO INDICATE WHERE ZIPALL1.USD IS !!!  *****************
  71. copy c:\pkware\zipall1.usd 
  72. if not exist zipall1.usd goto usdexit
  73. attrib -a zipall1.usd
  74. attrib -a allfiles.zip
  75. prompt $P$G
  76. dir
  77. echo.
  78. echo ALLFILES.ZIP has been successfully restored, all other files deleted.
  79. echo The Archive bit for ALLFILES.ZIP has been reset (off).
  80. echo ZIPALL1.BAT was used to create ALLFILES.ZIP for this directory only.
  81. echo If this directory has subdirectories, DO NOT DELETE their contents!
  82. goto exit
  83. :update
  84. if exist zipall1.usd del zipall1.usd
  85. pkzip allfiles.zip *.* -mu -whs -Jhrs -ex
  86. if errorlevel 1 goto errexit1
  87. attrib +a allfiles.zip
  88. REM *****************  USER MUST EDIT THE FOLLOWING LINE ********************* 
  89. REM *****************  TO INDICATE WHERE ZIPALL1.USD IS !!!  *****************
  90. copy c:\pkware\zipall1.usd
  91. if not exist zipall1.usd goto usdexit
  92. attrib -a zipall1.usd
  93. prompt $P$G
  94. dir
  95. echo.
  96. echo ALLFILES.ZIP has been updated with changed (and/or new) files.
  97. echo All other files have been deleted (except Read-only files.)
  98. echo.
  99. echo ZIPALL1.BAT was used to create ALLFILES.ZIP from this directory only.
  100. echo If this directory has subdirectories, DO NOT DELETE their contents!
  101. echo.
  102. goto exit
  103. :nowarn
  104. dir /aa /b /s | more
  105. echo.
  106. echo If any file names are listed above, they are files that were changed or added
  107. echo since you unzipped ALLFILES.ZIP with UNZIPALL.BAT.  You may want to Update
  108. echo ALLFILES.ZIP with the new versions of the changed files (and add any newly
  109. echo created files to it.)  Otherwise, you'll want to simply delete every file
  110. echo except ALLFILES.ZIP to leave it as it was before you ran UNZIPALL.BAT.
  111. echo Even if no files have changed, you can select Update to force the Archive
  112. echo attribute to be turned on for ALLFILES.ZIP, for backup purposes.
  113. echo Decide now, while viewing the list of files, above, before continuing.
  114. pause
  115. cls
  116. whichway X,U,N
  117. if errorlevel 255 goto abort
  118. if errorlevel 3 goto nochang2
  119. if errorlevel 2 goto update2
  120. if errorlevel 1 goto abort
  121. :nochang2
  122. attrib -h -s -r *.*
  123. pdel allfiles.zip /o /eq /ba /wh /nt 
  124. dir /ad /b | feed eatdir.bat
  125. if not exist allfiles.zip echo ALLFILES.ZIP blown ! -- Unerase now!!
  126. attrib -a allfiles.zip
  127. prompt $P$G
  128. dir
  129. echo.
  130. echo ALLFILES.ZIP has been successfully restored, all other files deleted.
  131. echo Child subdirectories, if any, have also been removed.
  132. echo ZIPALL.BAT was used to create ALLFILES.ZIP from this dir and any children dirs.
  133. goto exit
  134. :update2
  135. pkzip allfiles.zip *.* -mu -whs -Jhrs -ex -rp
  136. if errorlevel 1 goto errexit1 
  137. attrib -h -s -r *.*
  138. pdel allfiles.zip /o /eq /ba /wh /nt  
  139. dir /ad /b | feed eatdir.bat
  140. attrib +a allfiles.zip
  141. prompt $P$G
  142. dir
  143. echo.
  144. echo ALLFILES.ZIP has been updated with changed (and/or new) files.
  145. echo All other files have been deleted.
  146. echo Child subdirectories, if any, have also been removed.
  147. echo ZIPALL.BAT was used to create ALLFILES.ZIP from this dir and any children dirs.
  148. echo.
  149. echo RUN YOUR BACKUPS BEFORE UNZIPPING THIS ALLFILES AGAIN -- ARCHIVE BIT IS ON!
  150. echo.
  151. goto exit
  152. :errexit1
  153. echo Error in execution of PKZIP.EXE (in RESTZIP.BAT).
  154. echo ALLFILES.ZIP may not have been updated - Read messages above, generated 
  155. echo by PKZIP, and do a DIR to see what's in the current directory before
  156. echo proceeding.
  157. goto exit
  158. :usdexit
  159. echo Error in execution of RESTZIP.BAT.
  160. echo DID YOU READ THE INSTALLATION INSTRUCTIONS?
  161. echo You must edit two lines in RESTZIP.BAT and one line in ZIPALL1.BAT to 
  162. echo change the hardcoded location of ZIPALL1.USD from "c:\pkware" to 
  163. echo wherever you decided to install these batch files (and ZIPALL1.USD).
  164. echo Just locate the string "c:\pkware" and edit appropriately.
  165. pause
  166. goto exit
  167. :abort
  168. dir
  169. echo.
  170. echo RESTZIP aborted at point of decision.  No action taken.
  171. goto exit
  172. :exit
  173. echo on
  174.